﻿<!--
  This source code file contains modifications authored by Microsoft Corporation. 
  All such modifications are copyright (c) Microsoft Corporation. All rights reserved.
-->

<rules>
  <rule id="Feed.Core.1000" category="core" target="feed" specificationsection ="2.2.6.2.1" v4specificationsection="12" v4specification="odataatom" requirementlevel="must" format="atom">
    <description>An EntitySet or collection of entities MUST be represented as an &lt;atom:feed&gt; element.</description>
    <action processor="rng">
      <grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:atom="http://www.w3.org/2005/Atom">
        <start>
          <!-- Check whether the root level element starts with feed or not. -->
          <element name="atom:feed">
            <!-- Rest of the content is ignored. -->
            <ref name="anyAttribute" />
            <ref name="anyContent" />
          </element>
        </start>
        <define name="anyContent">
          <zeroOrMore>
            <choice>
              <attribute>
                <anyName />
              </attribute>
              <text />
              <ref name="anyElement" />
            </choice>
          </zeroOrMore>
        </define>
        <define name="anyAttribute">
          <zeroOrMore>
            <choice>
              <attribute>
                <anyName />
              </attribute>
            </choice>
          </zeroOrMore>
        </define>
        <define name="anyElement">
          <element>
            <anyName />
            <zeroOrMore>
              <choice>
                <attribute>
                  <anyName />
                </attribute>
                <text />
                <ref name="anyElement" />
              </choice>
            </zeroOrMore>
          </element>
        </define>
      </grammar>
    </action>
    <errormessage>An EntitySet or collection of entities MUST be represented as an &lt;atom:feed&gt; element.</errormessage>
  </rule>
</rules>